package com.mathlearning.auth.repository;

import com.mathlearning.auth.entity.ProblemFavorite;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface ProblemFavoriteRepository extends JpaRepository<ProblemFavorite, Long> {
    
    /**
     * 检查用户是否收藏某题
     */
    boolean existsByUserIdAndProblemId(Long userId, Long problemId);
    
    /**
     * 查找收藏记录
     */
    Optional<ProblemFavorite> findByUserIdAndProblemId(Long userId, Long problemId);
}








